home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 17 / AMIGAplus Sonderheft 17 (1999)(ICP)(DE)[!].iso / Rexx / databaseinfo.rexx < prev    next >
OS/2 REXX Batch file  |  1994-08-29  |  3KB  |  59 lines

  1. /* databaseinfo.rexx                                                    */
  2. /* by Edd Dumbill                                                       */
  3. /* Saturday 02-Jul-94 20:07:16                                          */
  4. /* scans the database currently being edited by Heddley                 */
  5.  
  6. OPTIONS RESULTS                             /* enable return codes      */
  7.  
  8. OPTIONS FAILAT 6                            /* ignore warnings          */
  9. SIGNAL ON SYNTAX                            /* ensure clean exit        */
  10. SIGNAL ON FAILURE                           /* trap Heddley errors      */
  11.  
  12. address 'HEDDLEY.1'
  13. query loaded var isl                        /* ask if database loaded   */
  14. if ~isl then                                /* if not, then...          */
  15.     do                                      /* say so, and...           */
  16.         say "No database loaded."           /* quit                     */
  17.         exit
  18.     end
  19.  
  20. options failat 30                           /* we stop at nothing!      */
  21. 'query database var DOG'                    /* ask for database name    */
  22. say 'Database ' DOG
  23. 'query master var DOG'                      /* ask for filename         */
  24. say 'Filename ' DOG
  25. 'query index var DOG'                       /* ask for index            */
  26. say 'Index    ' DOG
  27. say 'Documents...'
  28. say 'Name,Title,TOC,Temp. filename'
  29.  
  30. curdoc=1                                /* number of doc. to scan       */
  31. quit=0
  32. do while ~quit                              /* while not done...        */
  33.     goto number curdoc                      /* goto the next doc.       */
  34.     if RC=0 then                            /* if no error then         */
  35.         do
  36.             'query current var DNAME'       /* ask attributes of doc... */
  37.             'query doctitle var DTITLE'
  38.             'query doctoc var DTOC'
  39.             'query docfilename var DFNAME'
  40.             say DNAME','DTITLE','DTOC','DFNAME   /* and print them   */
  41.             curdoc=curdoc+1                     /* move on to next doc. */
  42.         end
  43.     else
  44.         quit=1                      /* goto failed so must be at end    */
  45. end
  46.  
  47.  
  48. EXIT                                        /* quit this macro          */
  49.  
  50. SYNTAX:                                     /* ARexx error...           */
  51.  
  52. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) /* report it...          */
  53. EXIT                                        /* exit                     */
  54.  
  55. FAILURE:                                    /* Heddley error...         */
  56. ERRV=address().LASTERROR                    /* get name of error var.   */
  57. SAY "Error:" VALUE(ERRV)                    /* report the error         */
  58. EXIT                                        /* exit                     */
  59.